<template>
	<view class="alterIntro">
		<view class="alterIntro-plate-1">
			<u-input v-model="value" type="textarea"  placeholder="填写个人简介更容易获得别人关注哦"/>
		</view>
		<view class="alterIntro-plate-2">
			<text>{{value.length}}/30</text>
		</view>
		<button class="btn" @click="saveIntro">保存</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value:''
			}
		},
		methods: {
			//保存个人简介
			saveIntro(){
				if(this.value.length <= 30){
					uni.request({
					    url:this.$Url +'/index.php/App/Users/editInfo',
					    method:'POST',
					    data:{
					       introduction:this.value
					    },
					    header:{
					        "token":uni.getStorageSync('token')
					    },
					    success: (res) => {
					       if(res.data.status == 200){
							   uni.showToast({
							   	title:res.data.msg
							   })
							   uni.navigateBack({
							   	delta:1
							   })
						   }else{
							   uni.showToast({
							   	title:res.data.msg,
								icon:'none'
							   })
						   }
					    }
					})
				}else{
					uni.showToast({
						title:'字数超过限制，快精简下吧',
						icon:'none'
					})
				}

			}
		}
	}
</script>

<style scoped lang="scss">
.alterIntro{
	width: 100vw;
	min-height: 100vh;
	background-color: #f7f7f7;
	.alterIntro-plate-1{
		height: 210upx;
		width: 100vw;
		background-color: #fff;
		font-size: 28upx;
		padding: 30upx;
	}
	.alterIntro-plate-2{
		display: flex;
		justify-content: flex-end;
		height: 60upx;
		align-items: center;
		text{
			margin-right: 30upx;
		}
	}
	.btn{
		display: flex;
		align-items: center;
		justify-content: center;
		border: none;
		background-color: #dbb769;
		width: 260upx;
		height: 75upx;
		border-radius: 80upx;
		color: #fff;
		margin-top: 80upx;
	}
}
</style>
